<%@ page import="com.biz.conf.Global" %>
<%@ include file="/jsp/taglib.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>信息编辑窗体</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <style>
        .fileInputContainer{
            width: 150px;
            background-size: 100% 100%;
            height: 150px;
            background-repeat: no-repeat;
        }
        .fileInput{
            position: absolute;
            top:30%;
            left:30%;
        }.upload_pic {
             height: 70px;
             width:70px;
             position: relative;
             cursor: pointer;
             color: #ccbe9e;
             background: #fff;
             overflow: hidden;
             display: inline-block;
             *display: inline;
             *zoom: 1;
         }
        .upload_pic input {
            position: absolute;
            height:100%;
            width:100%;
            right: 0;
            top: 0;
            opacity: 0;
            filter: alpha(opacity=0);
            cursor: pointer
        }
        .upload_pic:hover {
            color: #ccbe9e;
            background: #fff;
            text-decoration: none
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
              <%--  <div class="ibox-title">
                    <h5>用户管理</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>--%>
                <div class="ibox-content">
                    <form onsubmit="return  false" class="form-horizontal m-t" id="signupForm">
                        <input id="sysUser_id" value="${id}" name="sysUser.id" type="hidden">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">头像：</label>
                            <div class="col-sm-8">
                                <input type="hidden" id="picid2" value="${sysUser.coverId}" name="sysUser.coverId">
                                <div class="dtupload">
                                    <a href="javascript:" class="upload_pic" style="height:80px;"><input type="file" name="fileToUpload" id="upfile2" onChange="uploadFileEidt('upfile2','f03');">
                                        <img class="img-circle" id="f03" src="<%=Global.getConfig("OSSURL")%>/${sysUser.path}" width="100%"  height="100%"/>
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">用户名：</label>
                            <div class="col-sm-8">
                                <input id="sysUser_loginName" value="${sysUser.loginName}" name="sysUser.loginName" class="form-control" type="text" aria-required="true" aria-invalid="true" class="error">
                                <c:if test="${id =='' || id ==null}">
                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 密码默认和用户名相同</span>
                                </c:if>
                            </div>
                        </div>
                       <%-- <div class="form-group">
                            <label class="col-sm-3 control-label">密码：</label>
                            <div class="col-sm-8">
                                <input id="sysUser_pwd" value="${user.pwd}" name="sysUser.pwd" class="form-control" type="password">
                            </div>
                        </div>--%>
                      <%--  <div class="form-group">
                            <label class="col-sm-3 control-label">确认密码：</label>
                            <div class="col-sm-8">
                                <input id="confirm_password" name="confirm_password" class="form-control" type="password">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请再次输入您的密码</span>
                            </div>
                        </div>--%>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">姓名：</label>
                            <div class="col-sm-8">
                                <input id="sysUser_personName" value="${sysUser.personName}" name="sysUser.personName" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">手机号码：</label>
                            <div class="col-sm-8">
                                <input id="sysUser_phone" value="${sysUser.phone}" name="sysUser.phone" class="form-control" type="phone" aria-required="true" aria-invalid="false" class="valid">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">邮箱：</label>
                            <div class="col-sm-8">
                                <input id="sysUser_email" value="${sysUser.email}" name="sysUser.email" class="form-control" type="email">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注：</label>
                            <div class="col-sm-8">
                                <input id="sysUser_notes" value="${sysUser.notes}" name="sysUser.notes" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">排序：</label>
                            <div class="col-sm-8">
                                <input id="sysUser_sorts" value="99" value="${sysUser.sorts}" name="sysUser.sorts" class="form-control" type="number">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" onclick="doSubmit();">提交</button>
                                <button id="btn_close"  class="btn btn-primary" type="button">关闭</button>
                                <%--<button id="transmit"  class="btn btn-primary" type="button">给父页面传值</button>--%>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/content.min.js?v=1.0.0"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/validate/messages_zh.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/demo/form-validate-demo.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/layer2.4/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/ajaxfileupload.js"></script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/chosen/chosen.jquery.js"></script>
<script>
    var picPath='<%=Global.getConfig("OSSURL")%>';
    $(function(){
        //alert('${param.userCode}');
    });
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
   /* //parent.layer.iframeAuto(index);
    //让层自适应iframe
    $('#add').on('click', function(){
        $('body').append('插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。插入很多酱油。');

    });
    //给父页面传值
    $('#transmit').on('click', function(){

       // parent(".J_iframe").$("#spancc").text("5");
        alert(parent.$('#spancc').text());
        $(parent.window.frames["iframe8"].document).find("#spancc").html("我被改变了");
        $(parent.window.frames["iframe8"].document).find("#exampleTablePagination").bootstrapTable('refresh');
        //parent.$('#spancc').html('我被改变了');
        parent.layer.close(index);
    });*/

    //关闭iframe
    $('#btn_close').click(function(){
        parent.layer.close(index);
    });

    function doSubmit()
    {
        var loginName=$("#sysUser_loginName").val();
        var pwd=$("#sysUser_pwd").val();
        var personName=$("#sysUser_personName").val();
        var phone=$("#sysUser_phone").val();
        var email=$("#sysUser_email").val();
        var isOk=true;
        if(loginName==null||loginName==undefined||loginName==''){alert("请输入登录名");isOk= false;}
      /*  if(pwd==null||pwd==undefined||pwd==''){alert("请输入密码");isOk= false;}*/
        if(personName==null||personName==undefined||personName==''){alert("请输入姓名");isOk= false;}
        if(phone==null||phone==undefined||phone==''){alert("请输入手机号码");isOk= false;}
        if(email==null||email==undefined||email==''){alert("请输入邮箱");isOk= false;}
        if(isOk){
            $.ajax( {
                url:'${pageContext.request.contextPath}/sysUser/doSave.ac',// 跳转到 action
                data:$("#signupForm").serialize(),
                type:'post',
                cache:false,
                dataType:'json',
                success:function(data) {
                    if(data=="success")
                    {
                        alert("操作成功！");

                        parent.layer.close(index);
                    }else{
                        alert(data);
                    }
                },
                error : function() {
                    alert("操作失败！");
                }
            });
        }
    }

    //上传头像
    function uploadFileEidt(obj,pic){
        $.ajaxFileUpload  ({
            url: '${pageContext.request.contextPath}/file/doUploadFile.ac',
            secureuri: false,
            fileElementId: obj,
            dataType: 'json',
            beforeSend: function() {
                //$("#loading").show();
            },
            complete: function() {
                //$("#loading").hide();
            },
            success: function(data, status) {

                var hi=picPath+data.path;
                $("#"+pic).attr("src",hi);
                $("#picid2").attr("value",data.picId);
            },
            error: function(data, status, e) {
                alert(e);
            }
        });
    }
</script>

</body>

</html>

